﻿@inject IStringLocalizer<CherryMarkdownApi> Localizer

<CherryMarkdown @ref="@MarkdownElement" />
<Button OnClick="@InsertCheckList">@Localizer["InsertCheckListButtonText"]</Button>
<Button OnClick="@InsertPicture">@Localizer["InsertPictureButtonText"]</Button>

@code {
    [NotNull]
    private CherryMarkdown? MarkdownElement { get; set; }

    private async Task InsertCheckList()
    {
        await MarkdownElement.DoMethodAsync("toolbar.toolbarHandlers.insert", "checklist");
    }

    private async Task InsertPicture()
    {
        await MarkdownElement.DoMethodAsync("insert", "![一张图片](https://i.niupic.com/images/2022/04/01/9Y6T.jpg)", false, false, true);
    }
}
